package com.xinzhi.service.impl;

import com.xinzhi.mapper.TransferUserMapper;
import com.xinzhi.service.TransferUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;

@Service
public class TransferUserServiceImpl implements TransferUserService {

    @Autowired
    private TransferUserMapper transferUserMapper;

    @Override
    public BigDecimal findBalanceByBankAccount(String bankAccount) throws BankAccountNotFoundException {
        BigDecimal balance = transferUserMapper.selectBalanceByBankAccount(bankAccount);
        if (balance != null) {
            return balance;
        } else {
            throw new BankAccountNotFoundException("Bank account not found: " + bankAccount);
        }
    }
}
